/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sistemas.sisgear.entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Jean
 */
@Entity
@Table(name = "campo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Campo.todosDeSeccion", query = "SELECT c FROM Campo c JOIN c.idSeccion s WHERE s.idSeccion =:codigo"),
    @NamedQuery(name = "Campo.findAll", query = "SELECT c FROM Campo c"),
    @NamedQuery(name = "Campo.findByIdCampo", query = "SELECT c FROM Campo c WHERE c.idCampo = :idCampo"),
    @NamedQuery(name = "Campo.findByTama\u00f1o", query = "SELECT c FROM Campo c WHERE c.tama\u00f1o = :tama\u00f1o"),
    @NamedQuery(name = "Campo.findByTipo", query = "SELECT c FROM Campo c WHERE c.tipo = :tipo"),
    @NamedQuery(name = "Campo.findByCifrado", query = "SELECT c FROM Campo c WHERE c.cifrado = :cifrado"),
    @NamedQuery(name = "Campo.findByTransformacion", query = "SELECT c FROM Campo c WHERE c.transformacion = :transformacion"),
    @NamedQuery(name = "Campo.findByEtiqueta", query = "SELECT c FROM Campo c WHERE c.etiqueta = :etiqueta"),
    @NamedQuery(name = "Campo.findByPosT", query = "SELECT c FROM Campo c WHERE c.posT = :posT"),
    @NamedQuery(name = "Campo.findByCosultaSQL", query = "SELECT c FROM Campo c WHERE c.cosultaSQL = :cosultaSQL"),
    @NamedQuery(name = "Campo.findByColumnaQ", query = "SELECT c FROM Campo c WHERE c.columnaQ = :columnaQ")})
public class Campo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "idCampo")
    private String idCampo;
    @Basic(optional = false)
    @NotNull
    @Column(name = "Tama\u00f1o")
    private long tamaño;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 1)
    @Column(name = "Tipo")
    private String tipo;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 1)
    @Column(name = "Cifrado")
    private String cifrado;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 1)
    @Column(name = "Transformacion")
    private String transformacion;
    @Size(max = 50)
    @Column(name = "Etiqueta")
    private String etiqueta;
    @Basic(optional = false)
    @NotNull
    @Column(name = "PosT")
    private long posT;
    @Size(max = 1000)
    @Column(name = "cosultaSQL")
    private String cosultaSQL;
    @Size(max = 20)
    @Column(name = "columnaQ")
    private String columnaQ;
    @JoinColumn(name = "idSeccion", referencedColumnName = "idSeccion")
    @ManyToOne(optional = false)
    private Seccion idSeccion;

    public Campo() {
    }

    public Campo(String idCampo) {
        this.idCampo = idCampo;
    }

    public Campo(String idCampo, long tamaño, String tipo, String cifrado, String transformacion, long posT, Seccion idSeccion) {
        this.idCampo = idCampo;
        this.tamaño = tamaño;
        this.tipo = tipo;
        this.cifrado = cifrado;
        this.transformacion = transformacion;
        this.posT = posT;
        this.idSeccion = idSeccion;
    }

    public String getIdCampo() {
        return idCampo;
    }

    public void setIdCampo(String idCampo) {
        this.idCampo = idCampo;
    }

    public long getTamaño() {
        return tamaño;
    }

    public void setTamaño(long tamaño) {
        this.tamaño = tamaño;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    public String getCifrado() {
        return cifrado;
    }

    public void setCifrado(String cifrado) {
        this.cifrado = cifrado;
    }

    public String getTransformacion() {
        return transformacion;
    }

    public void setTransformacion(String transformacion) {
        this.transformacion = transformacion;
    }

    public String getEtiqueta() {
        return etiqueta;
    }

    public void setEtiqueta(String etiqueta) {
        this.etiqueta = etiqueta;
    }

    public long getPosT() {
        return posT;
    }

    public void setPosT(long posT) {
        this.posT = posT;
    }

    public String getCosultaSQL() {
        return cosultaSQL;
    }

    public void setCosultaSQL(String cosultaSQL) {
        this.cosultaSQL = cosultaSQL;
    }

    public String getColumnaQ() {
        return columnaQ;
    }

    public void setColumnaQ(String columnaQ) {
        this.columnaQ = columnaQ;
    }

    public Seccion getIdSeccion() {
        return idSeccion;
    }

    public void setIdSeccion(Seccion idSeccion) {
        this.idSeccion = idSeccion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCampo != null ? idCampo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Campo)) {
            return false;
        }
        Campo other = (Campo) object;
        if ((this.idCampo == null && other.idCampo != null) || (this.idCampo != null && !this.idCampo.equals(other.idCampo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.sistemas.sisgear.entidades.Campo[ idCampo=" + idCampo + " ]";
    }
    
}
